package com.zy.controller;

import com.zy.crypto.EncryptField;
import com.zy.crypto.EncryptMethod;
import com.zy.model.TUser;
import com.zy.service.UserService;
import com.zy.vo.ResponseVO;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhy
 * @date 2025/6/21 14:03
 */
@RestController
@RequestMapping("/t")
public class UserController {
    private final UserService service;

    public UserController(UserService service) {
        this.service = service;
    }

    @EncryptMethod
    @PostMapping
    public ResponseVO<TUser> insert(@RequestBody @EncryptField TUser user) {
        return service.insert(user);
    }

    @EncryptMethod
    @GetMapping
    public ResponseVO<List<TUser>> select(@EncryptField TUser user) {
        return service.select(user);
    }
}
